#ifndef __USER_HPP__
#define __USER_HPP__

#include "fastdo.hpp"
#include "ws_websocket.hpp"

class ProtocolObjectUser;
class Protocol;
class User
{
protected:
    winux::SharedPointer<ws::WsHttpRequestCtx> _ctx;

public:
    bool isLogged = false;
    long sessionTime = 0;
    winux::String token = "";

public:
    User();
    void login(winux::SharedPointer<ws::WsHttpRequestCtx> ctx);
    void logout();
    void send(Protocol *msg);
    inline bool isYourCtx(winux::SharedPointer<ws::WsHttpRequestCtx> ctx)
    {
        return _ctx.get() == ctx.get();
    }
    winux::SimplePointer<ProtocolObjectUser> toProtocol();
};
#endif //__USER_HPP__